package com.shelpe.services.tenant.service.impl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.shelpe.services.tenant.dao.ProductsMapper;
import com.shelpe.services.tenant.model.Products;
import com.shelpe.services.tenant.model.ProductsExample;
import com.shelpe.services.tenant.service.ProductService;

@Service
public class ProductServiceImpl implements ProductService{

	@Autowired
	private ProductsMapper productMapper;
	
	@Override
	public Products getProductById(Long numIid){
		
		return productMapper.selectByPrimaryKey(numIid);
	}
	
	@Override
	public int updateItems(Products product){

		return productMapper.updateByPrimaryKey(product);
	}
	
	@Override
	public List<Products> getItemsByUserId(long userId){
		ProductsExample ex = new ProductsExample();
		ex.createCriteria().andUserIdEqualTo(userId);
		
		return productMapper.selectByExample(ex);
	}
}
